<template>
  <div class="flowechartsbox">
    <el-menu
      :default-active="activeIndex"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
    >
      <el-menu-item index="1">流量趋势</el-menu-item>
      <el-menu-item index="2">访问趋势</el-menu-item>
    </el-menu>
    <div class="echarBox">
      <component :is="echartschange" />
    </div>
  </div>
</template>

<script>
import FlowEcharts from "@/views/homepage/flowAnalysis/FlowEcharts.vue";
import VisitEcharts from "@/views/homepage/flowAnalysis/VisitEcharts.vue";
export default {
  name: "FlowAnalysis",
  components: { FlowEcharts },
  data() {
    return {
      echartschange: FlowEcharts,
      activeIndex: "1",
    };
  },
  methods: {
    handleSelect(key) {
      //   console.log(key, keyPath);
      if (key == 1) {
        this.echartschange = FlowEcharts;
      } else {
        this.echartschange = VisitEcharts;
      }
    },
  },
};
</script>

<style scoped lang="scss">
.flowechartsbox {
  width: 100%;
  height: 300px;
  background-color: pink;
  .echarBox {
    padding: 10px;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    background-color: #fff;
  }
}
</style>
